import Vue from 'vue'
import Router from 'vue-router'
import Index from '../components/Index/index'
import Questions from '../components/Questions/questions'
import Datas from '../components/Datas/datas'
import User from '../components/User/user'
import LoginUser from '../components/LoginUser/loginUser'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/home',
      component: Index
    },
    {
      path: '/data',
      component: Datas
    },
    {
      path: '/user',
      component: User
    },
    {
      path: '/loginUser',
      component: LoginUser,
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      }
    },
    {
      path: '/questions',
      component: Questions,
      meta: {
        requireAuth: false // 添加该字段，表示进入这个路由是需要登录的
      }
    },
    {
      path: '/',
      redirect: '/home'
    }
  ]
})
